// https://www.luogu.com.cn/problem/T637676

#include <algorithm>
#include <cstdint>
#include <deque>
#include <iostream>
#include <istream>
#include <limits>
#include <ostream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using ll = int64_t;

/*
    dp[i][j]
    i 行 删去 j个1的最小代价
*/

template<class ...Ts>
void static inline l(Ts&&...ts){
    std::cout<<"Log:: ";
    ((std::cout<<std::forward<Ts>(ts)<<' '),...);
    std::cout<<'\n'<<std::flush;
}

ll n,m,k,sum{};
// std::vector<std::pair<ll, ll>> v;
std::vector<std::deque<std::tuple<ll,ll,ll>>> v;
std::vector<std::vector<ll>> dp;

int main(){
    std::iostream::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

    std::cin>>n>>m>>k;
    v.resize(n+1);
    dp.resize(n+1,std::vector<ll>(k+1));
    for(ll i=1;i<=n;i++){
        std::string s;
        std::cin>>s;
        s=' '+s;
        for(ll j=1;j<s.size();j++){
            if(s[j]=='1'){
                if(v[i].size()!=0){
                    std::get<2>(v[i].back()) = j-std::get<1>(v[i].back());
                    v[i].emplace_back(
                        j-std::get<1>(v[i].back()),
                        j,
                        0
                    );
                }else{
                    v[i].emplace_back(0,j,0);
                }
            }
        }
        if(v[i].size()==0){

        }else if(v[i].size()==1){
            sum+=1;
        }else{
            sum+=std::get<1>(v[i].back())-std::get<1>(v[i].front())+1;
        }
    }
    // l("sum:",sum);
    // throw;
    dp[0].assign(k+1,std::numeric_limits<ll>::max()-501);
    dp[0][0]=sum;
    for(ll i=1;i<=n;i++){
        ll nk=1;
        dp[i]=dp[i-1];
        for(;nk<=k;nk++){
            if(v[i].size()<=1){
                break;
            }
            ll nxt{};
            if(std::get<0>(v[i].front())<=std::get<2>(v[i].back())){
                nxt=std::get<2>(v[i].front());
                v[i].pop_front();
            }else{
                nxt=std::get<0>(v[i].back());
                v[i].pop_back();
            }
            // dp[i][nk]=std::min({
            //     dp[i-1][nk-1]-nxt,
            //     dp[i][nk-1]-nxt,
            //     dp[i][nk]
            // });
            for(ll j=1;j<=k;j++){
                dp[i][j]=std::min(dp[i-1][j-1]-nxt,dp[i][j]);
            }
        }
        if(v[i].size()==1&&nk<=k){
            dp[i][nk]=std::min(dp[i][nk],dp[i][nk-1]-1);
            v[i].pop_back();
            nk++;
        }
        // if(v[i].size()==0&&nk<=k){
        //     for(ll j=1;j<=k;j++){
        //         dp[i][j]=std::min(dp[i][j-1],dp[i][j]);
        //     }
        // }
    }
    ll ans=sum;
    for(ll i=1;i<dp[n].size();i++){
        ans=std::min(ans,dp[n][i]);
    }
    std::cout<<ans<<'\n';
}

/*
2 4 4
1111
1111

2 4 4
1001
1001
-3 -4|8 5 4
-3 -1|8 5 4
        8 5 2 1
        8 5 1 0

2 5 5
01001
10110
-3 -4   |8 5 4
-2 -3 -4|8 5 4 3
        |8 5 3 2 1
        |8 5 3 1 0 -1

2 5 5
10110
01001
-2 -1 -1|8 6 5 4
-3 -1   |8 5 4 4
        |8 
*/